import {
  CceInfo,
  ConfigInfo,
  CseInfo,
  DbInfo,
  DeployBaseInfo,
  DeployInfo,
  JobInfoParams,
  ResultInfo,
} from './model/deployInfoModel';
import { deployHttp } from '/@/utils/http/axios';

enum Api {
  BASE_INFO = '/v1/job/baseInfo',
  CCE_INFO = '/v1/job/cceInfo',
  DEPLOY_INFO = '/v1/job/deployInfo',
  CSE_INFO = '/v1/job/cseInfo',
  CONFIG_INFO = '/v1/job/configInfo',
  DB_INFO = '/v1/job/dbInfo',
  GATEWAY_CONFIG_INFO = '/v1/job/gatewayConfigInfo',
  RESULT_INFO = '/v1/job/resultInfo',
}

export const getBaseInfo = (params: JobInfoParams) => {
  return deployHttp.get<DeployBaseInfo>({ url: Api.BASE_INFO, params });
};

export const getCceInfo = (params: JobInfoParams) => {
  return deployHttp.get<CceInfo>({ url: Api.CCE_INFO, params });
};

export const getDeployInfo = (params: JobInfoParams) => {
  return deployHttp.get<DeployInfo>({ url: Api.DEPLOY_INFO, params });
};

export const getCseInfo = (params: JobInfoParams) => {
  return deployHttp.get<CseInfo>({ url: Api.CSE_INFO, params });
};

export const getConfigInfo = (params: JobInfoParams) => {
  return deployHttp.get<ConfigInfo>({ url: Api.CONFIG_INFO, params });
};

export const getDbInfo = (params: JobInfoParams) => {
  return deployHttp.get<DbInfo>({ url: Api.DB_INFO, params });
};

export const getGatewayConfigInfo = (params: JobInfoParams) => {
  return deployHttp.get<ConfigInfo>({
    url: Api.GATEWAY_CONFIG_INFO,
    params,
  });
};

export const getResultInfo = (params: JobInfoParams) => {
  return deployHttp.get<ResultInfo>({ url: Api.RESULT_INFO, params });
};
